Page({
  data:{
   height:null,
   weight:null,
   bmi:'',
   info:''
  },
  heightInput(e){
    this.setData({
      height: e.detail.value
  })
},
  weightInput(e){
    this.setData({
      weight:e.detail.value
    })
  },
  bmi:function(event){
    var weightnum=parseFloat(this.data.weight)
    var heightnum=parseFloat(this.data.height)
    var bmi=(weightnum/(heightnum/100)/(heightnum/100)).toFixed(2)
    var info=""
    if(bmi<18.5){
      info="过轻，加强营养！"
    }else if(bmi>=18.5&&bmi<23.9){
      info="正常，继续保持！"
    }else if(bmi>=23.9&&bmi<27.9){
      info="超重，加强锻炼!"
    }else if(bmi>=27.9){
      info="肥胖，提高警惕！"
    }
    console.log(bmi)
    console.log(info)
    this.setData({
      bmi:bmi,
      info:info
    })
  }
})
 